
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
//#include<bits/stdc++.h>
#include<algorithm>
using namespace std;
bool isNum(int num1, int num2, int num3)
{
	if (num1 == 0)
	{
		return false;
	}
	else
	{
		return (num2 == num1 * 2) && (num3 == 3 * num1);
	}
}
int main()
{
	int num[9] = { 1,2,3,4,5,6,7,8,9 };
	int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0;
	do
	{
		a = num[0];
		b = num[1];
		c = num[2];
		d = num[3];
		e = num[4];
		f = num[5];
		g = num[6];
		h = num[7];
		i = num[8];
		int A = a * 100 + b * 10 + c;
		int B = d * 100 + e * 10 + f;
		int C = g * 100 + h * 10 + i;
		if (isNum(A, B, C))
		{
			cout << A << " " << B << ' ' << C;
			cout << endl;
		}
	} while (next_permutation(num, num + 9));
	return 0;

}

